package fpzhan.plane.program.connect;

import fpzhan.plane.program.describe.ComposeComment;

import java.util.Collections;

public class ScopeMixCodeBlockConnect extends MixCodeBlockConnect {



    public ScopeMixCodeBlockConnect(CodeBlockContext context, ChainCodeBlockConnect source) {
        super(context, source);
        this.aloneCodeBlockCompose = new ScopeCodeBlockCompose();
    }


    public ComposeComment<ScopeCodeBlockCompose,ChainCodeBlockConnect> scope() {
        ChainCodeBlockConnect connect = new ChainCodeBlockConnect(getContext(),
                this);
        ((ScopeCodeBlockCompose) this.aloneCodeBlockCompose).setChild(connect);
        return new ComposeComment(((ScopeCodeBlockCompose) this.aloneCodeBlockCompose), connect);
    }



    public ChainCodeBlockConnect scopeEnd() {
        ChainCodeBlockConnect connect = (ChainCodeBlockConnect) getSource();
        connect.addChainBlocks(Collections.singletonList(this.aloneCodeBlockCompose));
        return connect;
    }


}
